home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / mpfeel.lha / MPFeel / Plurals / mp_utils.m < prev    next >
Text File  |  1992-05-12  |  3KB  |  120 lines

  1. /*
  2.  *    Plurals
  3.  *
  4.  *    Author:        S.C.Merrall
  5.  *
  6.  *    File:        mp_utils.m
  7.  *
  8.  *    Contents:    sp_memcpy
  9.  *            pp_memcpy
  10.  *
  11.  *    Description:       Functions that I feel should be in th mpl library
  12.  *            but aren't.
  13.  *
  14.  *    Change History:
  15.  *
  16.  *    Date   Name Comment
  17.  *    -------- ---- -------
  18.  *    22:02:91 SCM  Created
  19.  */
  20.  
  21. #include <stdio.h>
  22. #include "mp_debug_off.h"
  23.  
  24. /*----------------------------------------------------------------------------*
  25.  * Function   : sp_memcpy
  26.  *
  27.  * Parameters : plural char *to: locations on PEs to copy to
  28.  *        char *from:     location on ACU to copy from
  29.  *        int n:         how much to copy
  30.  *
  31.  * Description:    Same as memcpys all over the world except this copies from
  32.  *        the ACU to DPU.
  33.  *
  34.  * Result     : plural char *:    locations on the PEs copied to
  35.  *---------------------------------------------------------------------------*/
  36.  
  37. #ifdef __STDC__
  38.  
  39. plural char plural *sp_memcpy( plural char *plural to, char *from, int n )
  40.  
  41. #else
  42.  
  43. plural char *plural sp_memcpy( to, from, n )
  44.  
  45. plural char *plural to;
  46. char *from;
  47. int n;
  48.  
  49. #endif
  50.  
  51. {
  52. DBG_CALL("sp_memcpy");
  53. DBG_NULL(from);
  54. DBG_ARGS(fprintf(dbg,"to=????, from=%lx, n=%d",from,n));
  55.  
  56.  
  57.   for ( ; n > 0; --n) {
  58.  
  59.     *to = *from;
  60.     ++to;
  61.     ++from;
  62.  
  63.   }
  64.  
  65. DBG_EXIT(fprintf(dbg,"????"));
  66.   return to;
  67. }
  68.  
  69. /*----------------------------------------------------------------------------*
  70.  * Function   : pp_memswp
  71.  *
  72.  * Parameters : plural char *plural dest:    Where the block goes
  73.  *              plural int procids:             Which processor the block is on
  74.  *         plural char *plural from:    Where the block is
  75.  *        plural int size:        How big the block is
  76.  *
  77.  * Description: Copies blocks of memory between processors, the blocks may 
  78.  *        be located at the same address without this causing any
  79.  *        interference. Size and from refer to the same PE's
  80.  *
  81.  * Result     : plural char *plural:    The destination address
  82.  *---------------------------------------------------------------------------*/
  83.  
  84. #ifdef __STDC__
  85.  
  86. plural char *plural pp_memswp( plural char *plural dest, plural int procids,
  87.                            plural char *plural from, plural int size )
  88.  
  89. #else
  90.  
  91. plural char *plural pp_memswp( dest, procids, from, size )
  92.  
  93. plural char *plural dest;
  94. plural int procids;
  95. plural char *plural from;
  96. plural int size;
  97.  
  98. #endif
  99.  
  100. {
  101.   plural char tmp;
  102.   int  i;
  103.   plural int remote_sizes;
  104. DBG_CALL("pp_memswp");
  105. DBG_ARGS(fprintf(dbg,"dest=????, from=????, size=????"));
  106.  
  107.   remote_sizes = router[procids].size;
  108.   i = 0;
  109.  
  110.   while( i < remote_sizes ) {
  111.  
  112.     tmp=router[procids].(*(from + i));
  113.     *(dest + i) = tmp;
  114.     i++;
  115.   }
  116.  
  117. DBG_EXIT(fprintf(dbg,"????"));
  118.   return dest;
  119. }
  120.